﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UrlExtensions.cs" company="">
//   Copyright (c) 2010/2011 All Right Reserved
// </copyright>
// <summary>
//   Contains UrlExtensions class declaration.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace IBupro.Extensions
{
    using System.Web.Mvc;

    using iBuproModel;

    /// <summary>
    /// Provides methods that return actions' urls.
    /// Generation of urls from routing rules is done using 
    /// string literals, so it is safer to keep this in one place.
    /// </summary>
    public static class UrlExtensions
    {
        #region User

        public static string UserDetailsUrl(this UrlHelper urlHelper, User user)
        {
            return urlHelper.Action("Details", "User", new { id = user.Id });
        }

        public static string UserIndexUrl(this UrlHelper urlHelper)
        {
            return urlHelper.Action("Index", "User");
        }

        #endregion

        #region Department

        public static string DepartmentIndexUrl(this UrlHelper urlHelper)
        {
            return urlHelper.Action("Index", "Department");
        }

        public static string DepartmentDetailsUrl(this UrlHelper urlHelper, Department department)
        {
            return urlHelper.Action("Details", "Department", new { id = department.Id });
        }

        public static string DepartmentEditUrl(this UrlHelper urlHelper, Department department)
        {
            return urlHelper.Action("Edit", "Department", new { id = department.Id });
        }

        public static string DepartmentEditPrincipalsUrl(this UrlHelper urlHelper, Department department)
        {
            return urlHelper.Action("EditPrincipals", "Department", new { id = department.Id });
        }

        public static string DepartmentEditAdministratorsUrl(this UrlHelper urlHelper, Department department)
        {
            return urlHelper.Action("EditAdministrators", "Department", new { id = department.Id });
        }

        public static string DepartmentCreateUrl(this UrlHelper urlHelper)
        {
            return urlHelper.Action("Create", "Department");
        }

        public static string DepartmentMakeVisibleUrl(this UrlHelper urlHelper, Department department)
        {
            return urlHelper.Action("MakeVisible", "Department", new { id = department.Id });
        }

        public static string DepartmentMakeInvisibleUrl(this UrlHelper urlHelper, Department department)
        {
            return urlHelper.Action("MakeInvisible", "Department", new { id = department.Id });
        }

        public static string DepartmentSubjectsFilterUrl(this UrlHelper urlHelper, Department department)
        {
            return urlHelper.Action("Filter", "Subject", new { id = department.Id, what = "department" });
        }

       
        #endregion

        #region Principals

        public static string PrincipalIndexUrl(this UrlHelper urlHelper)
        {
            return urlHelper.Action("Index", "Principal");
        }

        #endregion

        #region StudentPlan

        public static string StudentPlanIndexUrl(this UrlHelper urlHelper)
        {
            return urlHelper.Action("Index", "StudentPlan");
        }

        #endregion

        #region StudentField

        public static string StudentFieldIndexUrl(this UrlHelper urlHelper)
        {
            return urlHelper.Action("Index", "StudentField");
        }

        #endregion

        #region Subjects

        public static string SubjectIndexUrl(this UrlHelper urlHelper)
        {
            return urlHelper.Action("Index", "Subject");
        }

        #endregion

        #region Lector

        public static string LectorIndexUrl(this UrlHelper urlHelper)
        {
            return urlHelper.Action("Index", "Lector");
        }

        #endregion        
        
        #region Student

        public static string StudentIndexUrl(this UrlHelper urlHelper)
        {
            return urlHelper.Action("Index", "Student");
        }

        public static string StudentEditUrl(this UrlHelper urlHelper)
        {
            return urlHelper.Action("Edit", "Student");
        }

        public static string StudentDiplomProjectUrl(this UrlHelper urlHelper)
        {
            return urlHelper.Action("DiplomProject", "Student");
        }

        #endregion

        #region DiplomProject

        public static string DiplomProjectIndexUrl(this UrlHelper urlHelper)
        {
            return urlHelper.Action("Index", "DiplomProject");
        }

        public static string DiplomProjectSubscribeUrl(this UrlHelper urlHelper, DiplomProject diplomProject)
        {
            return urlHelper.Action("Subscribe", "DiplomProject", new {id = diplomProject.Id});
        }

        #endregion
        
        #region Content

        public static string CssFileUrl(this UrlHelper urlHelper, string filename)
        {
            return "../../Content/" + filename;
        }

        public static string ImageFileUrl(this UrlHelper urlHelper, string filename)
        {
            return "../../Content/Images/" + filename;
        }


        public static string StaticContent(this UrlHelper urlHelper, string file)
        {
            return urlHelper.Action("Index", "StaticHtml", new { url = file });
        }

        #endregion

        #region Culture

        public static string SetCultureUrl(this UrlHelper urlHelper, string cultureCode)
        {
            return urlHelper.Action("Culture", "Home", new { id = cultureCode });
        }

        #endregion
        
    }
}